<template>
    <div>
        <div class="hg_newboxlef">
            <el-carousel height="310px" :interval="3000">
                <el-carousel-item
                    v-for="(item, index) in dataList"
                    :key="index"
                >
                    <div
                        class="swper_li"
                        @click="
                            turnBlank(2, { typeId: item.typeId, id: item.id })
                        "
                    >
                        <img
                            :src="
                                item.cmsFile[0]
                                    ? item.cmsFile[0].path
                                    : require('@/assets/img/hg/bannerceshi.png')
                            "
                            alt=""
                        />
                        <h5>
                            <p>
                                {{ item.name }}
                            </p>
                        </h5>
                    </div>
                </el-carousel-item>
            </el-carousel>
        </div>
    </div>
</template>

<script>
import appUtil from '~/assets/utils/appUtil';
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('hgModule');
export default {
    name: 'test',
    data() {
        return {
            dataList: [],
            icur: '3403205245188330548',
            title: '最新公告',
        };
    },
    mounted() {
        this.getdataList(1, 4, this.icur);
    },
    methods: {
        ...mapActions(['getdataListsAsync']),
        turnBlank(type, Parameters) {
            appUtil.routerUrl(type, Parameters, this.title, this.icur);
        },
        getdataList(pn, ps, categoryId) {
            this.getdataListsAsync({
                pn,
                ps,
                categoryId,
            }).then((res) => {
                this.dataList = res.data.dataList;
                for (let i = 0; i < this.dataList.length; i++) {
                    if (this.dataList[i].cmsArticle) {
                        this.dataList[
                            i
                        ].cmsArticle.content = appUtil.strIntercept(
                            this.dataList[i].cmsArticle.content
                        );
                    }
                }
            });
        },
    },
};
</script>

<style lang="scss" scoped>
 .el-carousel__indicators--horizontal {
    bottom: 9px;
    left: auto;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    right: 0%;
}

 .el-carousel__button {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 2px;
    background-color: #fff;
    border: none;
    outline: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-transition: 0.3s;
    transition: 0.3s;
}

 .el-carousel__indicator--horizontal {
    display: inline-block;
    padding: 13px 2.5px;
}

.hg_newboxlef {
    width: 100%;
    height: 310px;

    .swper_li {
        width: 100%;
        height: 100%;
        position: relative;
        cursor: pointer;

        img {
            width: 100%;
        }

        h5 {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            background: rgba(0, 0, 0, 0.59);
            height: 44px;
            line-height: 44px;

            p {
                font-size: 16px;
                font-weight: 400;
                color: #ffffff;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                padding: 0 10px;
                max-width: 300px;
            }
        }
    }

     .is-active .el-carousel__button {
        width: 12px;
        background-color: #3e8cff;
    }
}
.hg_liclass {
    .hg_boxchildtop {
        display: none;
    }
    .hg_boxlist {
        display: block;
    }
}
.hg_newboxrig {
    margin-left: 565px;
    height: 310px;

    .hg_active {
        .hg_boxchildtop {
            display: block;
        }
        .hg_boxlist {
            display: none;
        }
    }

    .hg_boxchildtop {
        height: 168px;
        background: #f7f7f7;
        border-radius: 4px;
        padding: 0 20px;
        cursor: pointer;

        h1 {
            font-size: 26px;
            padding-top: 14px;
            font-weight: 600;
            color: #333333;
            line-height: 35px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding-right: 10px;
        }

        h2 {
            font-size: 12px;
            color: #aaa;
            font-weight: normal;
            height: 20px;
            line-height: 20px;
            margin: 11px auto;

            img {
                float: left;
                margin: 4px 5px 0 2px;
            }

            span {
                float: left;
            }
        }

        h3 {
            font-size: 14px;
            font-weight: 400;
            color: #555555;
            line-height: 24px;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            overflow: hidden;

            a {
                font-size: 10px;
                font-weight: 400;
                color: #094191;
                line-height: 26px;
                float: right;
            }
        }
    }

    .hg_boxlist {
        a {
            width: 100%;
            display: inline-block;
            border-bottom: 1px solid #eaeaea;
            height: 45px;
            line-height: 45px;
            cursor: pointer;

            i {
                float: left;
                width: 4px;
                height: 4px;
                background: #999999;
                border-radius: 2px;
                margin: 21px 10px 0 5px;
            }

            span {
                float: left;
                font-size: 14px;
                font-weight: 400;
                color: #333333;
                max-width: 75%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            b {
                float: right;
                font-size: 14px;
                font-weight: 400;
                color: #666666;
                margin-right: 20px;
            }
        }
    }
}
</style>
